package com.google.projectulator;

import java.util.ArrayList;
import java.util.List;

import org.apache.maven.project.MavenProject;

/**
 * Represents a process for a MavenProject.  Has a status, error information
 * and a reference to the MavenProject itself.
 * 
 * @author Lance Woodson
 *
 */
public class ProjectState extends ProcessingState {
	private MavenProject mavenProject;
	private String name;
	private String relativePath;
	private List<ProcessorState> processorStates;
	
	public ProjectState(MavenProject mavenProject) {
		super();
		this.mavenProject = mavenProject;
		this.name = mavenProject.getName();
	}
	
	public void loadWithProcessors(List<Processor> processors) {
		processorStates = new ArrayList<ProcessorState>();
		for(Processor processor : processors) {
			processorStates.add(new ProcessorState(processor));
		}
	}
	
	public MavenProject getMavenProject() {
		return mavenProject;
	}
	
	public void setMavenProject(MavenProject project) {
		this.mavenProject = project;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getRelativePath() {
		return relativePath;
	}
	
	public void setRelativePath(String relativePath) {
		this.relativePath = relativePath;
	}
	
	public List<ProcessorState> getProcessorStates() {
		return processorStates;
	}
	
	public void setProcessorStates(List<ProcessorState> processorStates) {
		this.processorStates = processorStates;
	}
	
	@Override
	public String toString() {
		return "ProjectState(" + mavenProject.getName() + ")";
	}
}
